package model

type Tasks struct {
	Name      string     `json:"name"`
	TestCases []TestCase `gorm:"many2many:testcase_task;ForeignKey:ID;References:ID" json:"testcases"`
}

// 运行任务
func (task *HisTask) Start() {
	if task.RunWay == "串行" {
		for _, v := range task.TaskGroups {
			v.StartGroup()
		}
	} else {
		for _, v := range task.TaskGroups {
			go v.StartGroup()
		}
	}

}

// 运行任务组
func (task *TaskGroup) StartGroup() {
	if task.RunWay == "串行" {
		for _, t := range task.Tasks {
			t.RunSubTask()
		}
	} else {
		for _, t := range task.Tasks {
			go t.RunSubTask()
		}
	}

}

// 运行子任务
func (t *Tasks) RunSubTask() {

}
